{include file="public/header" /}

<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:url('admin/index/info')}">首页</a> &raquo; 轮播列表
</div>
<!--面包屑导航 结束-->

<!--搜索结果页面 列表 开始-->
<form action="#" method="post">
    <div class="result_wrap">
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="result_title">
                <h3>轮播管理操作</h3>
            </div>
            <div class="short_wrap">
                <a href="{:url('admin/lunbo/add')}"><i class="fa fa-plus"></i>添加轮播</a>
                <a href="{:url('admin/lunbo/index')}"><i class="fa fa-recycle"></i>轮播列表</a>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <table class="list_tab">
                <tr>
                    <th class="tc">排序</th>
                    <th class="tc">ID</th>
                    <th>缩略图</th>
                    <th width="20%">描述</th>
                    <th>链接</th>
                    <th>操作</th>
                </tr>

                {foreach name="list" item="v"}
                <tr>
                    <td class="tc">
                        <input type="text" onchange="changeOrder(this, {$v->id});" name="ord[]" value="{$v->sort_order}">
                    </td>
                    <td class="tc">{$v->id}</td>
                    <td>
                        <img src="{$v->img_url}" alt="缩略图" width="500px" height="150px">
                    </td>
                    <td>{$v->tips}</td>
                    <td>{$v->href}</td>
                    <td>
                        <a href="{:url('/admin/lunbo/edit/id/'. $v->id)}">修改</a>
                        <a href="javascript:;" onclick="deleteAction('{$v->id}')">删除</a>
                    </td>
                </tr>
                {/foreach}

            </table>

            <div class="page_nav">
                <div>
                </div>
            </div>
            <style type="text/css">
                .result_content ul li span {
                    font-size: 15px;
                    padding: 6px 12px;
                }
            </style>

        </div>
    </div>
</form>
<!--搜索结果页面 列表 结束-->
<script>
    function changeOrder(obj, id) {
        var order = $(obj).val();
        $.post("{:url('admin/common/change_order')}",{'type':'article','id':id,'order':order,'field':'art_order'}, function (data) {
            layer.msg(data.msg);
        },'json')
    }

    function deleteAction(id) {
        //询问框
        layer.confirm('您确定要删除这个轮播吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            //发送post请求
            $.post("{:url('/admin/lunbo/delete')}", {_method:'DELETE','_token':'csrf_token',id:id}, function (data) {
                if(data.errno) {
                    layer.msg(data.msg, {icon: 2});
                }else {
                    layer.msg('删除成功', {icon: 1});
                    setTimeout(function () {
                        location.href=location.href;
                    }, 2000);
                }
            },'json');
        }, function(){
            //layer.msg('11', {icon: 2});
        });
    }
</script>

{include file="public/footer" /}